<template>
  <div class="app-container">
    <el-table
      v-loading="listLoading"
      :data="list"
      element-loading-text="Loading"
      border
      fit
      highlight-current-row
    >
      <el-table-column align="center" label="学号" width="95">
       <template slot-scope="scope">
        {{ scope.row.son }}
        </template>
      </el-table-column>
      <el-table-column label="姓名"width="100">
     <template slot-scope="scope">
      {{ scope.row.name }}
      </template>
      </el-table-column>
      <el-table-column label="性别" width="110" align="center">
       <template slot-scope="scope">
        {{ scope.row.sex }}
        </template>
      </el-table-column>
      <el-table-column label="学院" width="110" align="center">
       <template slot-scope="scope">
        {{ scope.row.college }}
        </template>
      </el-table-column>
      <el-table-column label="专业" width="110" align="center">
      <template slot-scope="scope">
       {{ scope.row.major }}
       </template>
      </el-table-column>
      <el-table-column label="班级" width="110" align="center">
       <template slot-scope="scope">
        {{ scope.row.clas }}
        </template>
      </el-table-column>

      <el-table-column label="家庭住址" width="110" align="center">
       <template slot-scope="scope">
        {{ scope.row.address }}
        </template>
      </el-table-column>
      <el-table-column label="电话号码" width="110" align="center">
       <template slot-scope="scope">
        {{ scope.row.tel }}
        </template>
      </el-table-column>
      <el-table-column label="邮箱" width="110" align="center">
       <template slot-scope="scope">
        {{ scope.row.mailbox }}
        </template>
      </el-table-column>
      <el-table-column label="账号" width="110" align="center">
      <template slot-scope="scope">
       {{ scope.row.accountnumber }}
       </template>
      </el-table-column>
      <el-table-column label="密码" width="110" align="center">
       <template slot-scope="scope">
        {{ scope.row.password }}
        </template>
      </el-table-column>
      <el-table-column label="操作" align="center" width="245" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button type="primary" size="mini" @click="edit(scope.row.code)" >
            编辑
          </el-button>
          <el-button size="mini" type="danger">
            删除
          </el-button>
        </template>
      </el-table-column>
      
    </el-table>
  </div>
</template>

<script>
  import {
    getList
  } from '@/api/information/tableIS.js'

  export default {
    filters: {
      statusFilter(status) {
        const statusMap = {
          published: 'success',
          draft: 'gray',
          deleted: 'danger'
        }
        return statusMap[status]
      }
    },
    data() {
      return {
        list: null,
      }
    },
    created() {
      this.fetchData()
    },
   methods: {
       fetchData() {
          var vm = this;
               getList().then(res => {
                 console.log(res.content);
                 vm.list = res.content;
         })
       }
     }
   }
</script>
